<?
class Default_Form_Recipe extends Zend_Form
{
    public function init()
    {
        //$this->setAction('/2533/recipeform');
        $this->setMethod('post')
             ->setAttrib('enctype', 'multipart/form-data');
        
        $id = new Zend_Form_Element_Hidden('id');
        
        $recipeName = new Zend_Form_Element_Text('recipe_name'); 
        $recipeName->setRequired(true)
             ->setLabel('Название блюда:');
        
        $type = new Zend_Form_Element_Text('food_types');
        $type->setRequired(true)
             ->setLabel('Тип блюда:');
             
        $ingredients = new Zend_Form_Element_Textarea('ingredients');
        $ingredients->setRequired(true)
                    ->setLabel('Ингредиенты:');
                    
        $process = new Zend_Form_Element_Textarea('process');
        $process->setRequired(true)
                ->setLabel('Процесс приготовления:');
                
        $photo = new Zend_Form_Element_File('photo');
        $photo->setLabel('Фото готового блюда:')
              ->setDestination('images/food/original');
              
        $ingredientsPhoto = new Zend_Form_Element_File('ingredientsPhoto');
        $ingredientsPhoto->setLabel('Фото ингредиентов:')
                         ->setDestination('images/ingredients/original');
        
        $information = new Zend_Form_Element_Textarea('info');
        $information->setLabel('Информация о блюде:');
                    
        $spentTime = new Zend_Form_Element_Text('time');
        $spentTime->setRequired(true)
                    ->setLabel('Потраченное время:');
                    
        $source = new Zend_Form_Element_Text('source');
        $source->setLabel('Откуда информация о блюде:');
        
        $authorId = new Zend_Form_Element_Hidden('author_id');
        
        $themes = $this->createElement('multiCheckbox', 'themes');
		$themes->setLabel('Тематики:');
		
		$recipesManager = new Default_Model_Managers_Recipes();
		$themesList = $recipesManager->getAllThemes();
		foreach($themesList as $themeItem) {
			$themes->addMultiOption($themeItem['theme_id'], $themeItem['theme_name']);
		}
		        
        $button = new Zend_Form_Element_Submit('save');
        $button->setRequired(true)
               ->setLabel('Сохранить');
              
              
        $this->addElements(array(
            $id,
            $recipeName,
            $type,
            $ingredients,
            $process,
            $ingredientsPhoto,
            $photo,
            $information,
            $spentTime,
            $source,
            $themes,
            $button,
            $authorId
            
        ));
    }
}